<template>


    <table class="table table bordered">

 <thead>


    <tr>
<th>         
      <select v-model="aaa.MR_Id">
        <option :value="-1" >--请选择---</option>
            <option   option  v-for="item in Member " :value="item.MR_Id">{{ item.MR_Name }}</option>
            </select>
            </th>
            </tr>

            <tr>
                <th>       
              <select v-model="aaa.Rank_Id" > 
            <option :value="-1">--请选择---</option>
                <option v-for="item in Rank" :value="item.Rank_Id">{{ item.Rank_Name }}</option>
            </select>
            </th>
            </tr>

            <tr>
                <th>              

          <button @click="AddMe" > 添加</button>
            </th>
            </tr>
 </thead>


</table>



</template>
<script setup lang="ts">

import axios from 'axios';
import {onMounted, ref} from 'vue';

onMounted(()=>{

XiaLa1();
XiaLa2();
})


const Member =ref([{
MR_Id: 0,
MR_Name: "",
MR_Info: "",
MR_IsCustion: "",
MR_RuleType:"",
MR_Rule: ""

}])

const XiaLa1 =()=>{

axios.get('https://localhost:7035/api/Member/ShowMe?Type1=0').then(res=>{

   Member.value=res.data
}).catch(error=>{
    console.log(error)

})

}



const Rank =ref([{
    Rank_Id: 0,
    Rank_Name: "",
    Rank_State: true,
    Rank_MaxPoint: 0,
    Rank_MinPoint: 0,
    Rank_IsDel: true,
    Rank_DeleteTime: ""

}])




const XiaLa2 =()=>{

axios.get('https://localhost:7035/api/Rank/ShowRank').then(res=>{

    Rank.value=res.data
}).catch(error=>{
    console.log(error)

})

}





const aaa=ref({
 
    Rank_Id:-1,
    MR_Id: -1,
    IsDel:true




})
const AddMe=()=>{

    axios.post('https://localhost:7035/api/Hight/AddHi',aaa.value)
    .then(ref=>{

        if(ref.data>0)
    {
                alert('添加成功')

    }
    else if(ref.data==-1)
    {
        alert('等级状态被禁用不可添加')
    }
    else
    {
        alert('添加失败')
    }
    })


}



</script>